package fair.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import fair.pojo.Record;
import fair.mapper.RecordMapper;
import fair.service.IRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import fair.service.IUserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 * 日志表 服务实现类
 * </p>
 *
 * @author fair
 * @since 2021-03-04
 */
@Slf4j
@Transactional
@Service(interfaceClass = IRecordService.class, version = "${dubbo.service.core.version}", group = "${dubbo.service.core.group}", retries = -1)
public class RecordServiceImpl extends ServiceImpl<RecordMapper, Record> implements IRecordService {

    @Autowired
    private RecordMapper recordMapper;

    public List<Record> findByPage(String pageNum, String pageSize) {
        IPage<Record> page = new Page<Record>();
        page.setSize(Integer.parseInt(pageSize));
        page.setCurrent(Integer.parseInt(pageNum));
        page = recordMapper.selectPage(page, new QueryWrapper<>());
        return page.getRecords();
    }
}
